<?php
class IncomeModel extends FinanceModel {
    /**
     * income range
     */
    public function get_inc_range() {
        $res = $this->field('MAX(create_time) time_max, MIN(create_time) time_min')->find();
        
        $today = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
        $res['time_max']<$today && $res['time_max'] = $today;
        return $res;
    }
    
    /**
     * get income sum
     */
    public function get_sum() {
    	$res = $this->field('SUM(amount) inc_sum')->find();
      return $res['inc_sum'];
    }
}
?>
